package cas.ihep.util;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * Created by chocolate on 2017/12/21.
 */
public class RedirectIO implements Runnable{
    private InputStream is;
    private OutputStream os;
    public RedirectIO(InputStream i,OutputStream o){
        is =i;
        os =o;

    }
    public void run(){
        try {
            byte[] buf = new byte[4096];
            int each;
            while ((each = is.read(buf))!=-1){
                os.write(buf,0,each);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
